package com.jic.member.controller.rest;

import com.jic.common.base.vo.RestResult;
import com.jic.member.api.rest.MememberGradeApi;
import com.jic.member.request.MemberGradeRequest;
import com.jic.member.request.QueryMemLevelListByIdsRequest;
import com.jic.member.request.power.MememberLegalRuleRequest;
import com.jic.member.response.MememberGradeForMarket;
import com.jic.member.response.MememberGradeResponse;
import com.jic.member.response.power.MememberLegalRuleResponse;
import com.jic.member.service.MememberGradeService;
import com.jic.member.service.power.MemberRuleService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rest/grade")
@Api(tags = {"会员等级权益接口"})
@Slf4j
public class MememberGradeOperationController implements MememberGradeApi {

    @Autowired
    private MemberRuleService memberRuleService;

    @Autowired
    private MememberGradeService mememberGradeService;


    @RequestMapping("/queryMemberRule")
    @Override
    public List<MememberLegalRuleResponse> queryMemberRule(@RequestBody  MememberLegalRuleRequest mememberLegalRuleRequest) {
        return memberRuleService.queryMemberRule(mememberLegalRuleRequest);
    }

    /**
     * 根据条件查询会员等级配置表
     * @param request 入参
     * @Author tzc
     * @return 包含MemberGradeResponse的列表；
     * @Date 2020-7-1 01:13:25
     */
    @RequestMapping("/query")
    @Override
    public RestResult<List<MememberGradeForMarket>> listMemberGradeForMarket(@RequestBody MemberGradeRequest request) {
        RestResult<List<MememberGradeForMarket>> list = mememberGradeService.listMememberGradeByParam(request);
        return list;
    }

    @PostMapping("/queryMemLevelListByIds")
    public RestResult<List<MememberGradeResponse>> queryMemLevelListByIds(@RequestBody QueryMemLevelListByIdsRequest request) {
        RestResult<List<MememberGradeResponse>> list = mememberGradeService.queryMemLevelListByIds(request);
        return list;
    }

}
